﻿using System;
using metroioc.Container;

namespace MetroIoc
{
    public class Transient : IRegistration
    {
        public void Register(Type type, string key, Func<LifetimeScope, object> resolverFunc)
        {
            //  Do nothing in the transient manager. We do not need to store
            //  the resolver func, as it will be passed into the call to resolve.
        }

        public object Resolve(Type type, string key, Func<LifetimeScope, object> resolverFunc, LifetimeScope resolver)
        {
            if (resolverFunc == null)
                throw new ArgumentNullException("resolverFunc");

            return resolverFunc(resolver);
        }
    }
}
